package Factory

import "factory/models"

//总工厂
const (
	ProductTechBook = iota
	ProductDailyAV
	//...定义商品编号
)

type ProductType int

//把每个工厂的共有方法封装
type IprodoctFactory interface {
	CreateProduct(t ProductType) Iproduct
}
type Iproduct interface {
	Getinfo() int
}
type TechFactory struct{}

func (*TechFactory) CreateProduct(t ProductType) Iproduct {
	switch t {
	case ProductTechBook:
		return &models.Book{}
	}
	return nil
}

type ProductDaily struct{}

func (*ProductDaily) CreateProduct(t ProductType) Iproduct {
	switch t {
	case ProductDailyAV:
		return &models.AV{}
	}
	return nil
}
